﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Uniforax.Core.Common;

namespace Uniforax.Core.GameActions.GridMove
{
    public class GridEnterAction : BaseGridMoveAction
    {

        // 移动的目标。
        public PosId ToPosId { get; set; }


        public override void Execute(ActionContext context)
        {
            var world = context.GameWorld;
            var grid = world.GetGrid(ToPosId);
            var gameObject = world.GetRestoredTempGameObject(ObjectId);

            var enterContext = new GameObjectEnterGridMovementContext()
            {
                GameObject = gameObject,
                NewGrid = grid,
            };

            grid.OnGameObjectEnter(context, enterContext);
            gameObject.OnEnterGrid(context, enterContext);

        }

        public override void Undo(ActionContext context)
        {

        }
    }
}
